
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@uxland/event-aggregator
Advanced tools
Build Status | Statements | Branches | Functions | Lines |
---|---|---|---|---|
npm i @uxland/event-aggregator
It is possible to define numerous instances of the Event Aggregator within a project, each one with the same or different events subscribed, simulating each instance as a new channel of communication.
const EA = new EventAggregator();
const EA2 = new EventAggregator();
EA.subscribe('event', () => {...});
EA2.subscribe('event2', () => {...});
EA.subscribe('common-event', () => {...});
EA2.subscribe('common-event', () => {...});
To publish an event you must specify an eventId and an optional payload that will be collected by subscriber.
const payload = { foo: "bar" };
publish("EVENT-ID", payload);
It is possible also to provide a class instead of a string event
publish(new Klass(), callback);
If a subscription is done with provided class, the callback provided at the subscription moment will be called.
In order to subscribe to an event you must specify an eventId and a callback function that will be called when that event is received.
const callback = (payload: any): void => {};
subscribe("EVENT-ID", callback);
It is possible also to provide a class instead of a string event
subscribe(Klass, callback);
In order to subscribe to an event, only once, you must specify an eventId and a callback function that will be called when that event is received. For the next publishes of that event, this subscriber will not receive that event.
const callback = (payload: any): void => {};
subscribeOnce("EVENT-ID", callback);
FAQs
Event Aggregator
The npm package @uxland/event-aggregator receives a total of 44 weekly downloads. As such, @uxland/event-aggregator popularity was classified as not popular.
We found that @uxland/event-aggregator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.